﻿<Window x:Class="UsingNonMVVMElements.MainWindowBindingReflectorView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="481" Width="688"
        xmlns:vm="clr-namespace:UsingNonMVVMElements.ViewModel"
        xmlns:converter="clr-namespace:UsingNonMVVMElements.Converter"
        xmlns:core="clr-namespace:UsingNonMVVMElements.Core"        
        Title="MVVM Survival Guide - Binding Reflector">
    <Window.DataContext>
        <vm:MainWindowViewModel />
    </Window.DataContext>
    <Window.Resources>
        <converter:UriConverter x:Key="uriConverter" />
    </Window.Resources>
    <Grid x:Name="LayoutRoot">       
        <TextBox Height="27" HorizontalAlignment="Left" Margin="2,1,0,0" 
                 Name="textBoxUrl" VerticalAlignment="Top" Width="611"
                 Text="{Binding UserSuggestedSourcePage}" />
        <Button Content="Go" Height="27" HorizontalAlignment="Left" 
                Margin="615,1,0,0" Name="btnGo" VerticalAlignment="Top" 
                Width="39" IsDefault="True"
                Command="{Binding NavigateUrlCommand}" />
        <WebBrowser x:Name="webBrowser" Margin="0,34,0,0" />
        <core:BindingReflector            
            x:Name="sourceReflector">
            <core:BindingReflector.Target>
                <!--Target="{Binding ElementName=webBrowser, Path=Source, Mode=OneWayToSource}"-->
                <!--Source="{Binding SourcePage, Mode=OneWay}" -->
                <Binding ElementName="webBrowser" 
                         Path="Source" Mode="OneWayToSource"
                          />
            </core:BindingReflector.Target>
            <core:BindingReflector.Source>
                <Binding Path="SourcePage" Mode="OneWay" 
                         Converter="{StaticResource uriConverter}"/>
            </core:BindingReflector.Source>
        </core:BindingReflector>
    </Grid>    
</Window>

